# js2ts Version 1 build process
# J.R. Cordy, Huawei Technologies, September 2023

# This process builds the standalone js2ts tool
# Two versions are created: js2ts, for single files, and js2tsmf, for use with the multifile process

SRCS = txl/argument-types.rul txl/arithmetic-types.rul txl/assignment-types.rul txl/bom.grm \
    txl/builtin-call-types.rul txl/builtin-static-types.rul txl/call-types.rul txl/cast-types.rul txl/closure-types.rul \
    txl/conditional-types.rul txl/convert-literals.rul txl/default-types.rul txl/dynamic-types.rul txl/equality-types.rul \
    txl/expand-imports.rul txl/final-types.rul txl/formal-types.rul txl/function-types.rul txl/infer-variables.rul \
    txl/initializer-types.rul txl/js-ts.grm txl/js.txl txl/js2ts-split.txl txl/js2ts.txl \
    txl/jsparse.txl txl/literal-types.rul txl/logical-types.rul txl/merge-types.rul txl/newobject-types.rul \
    txl/normalize-expressions.rul txl/normalize-functions.rul txl/normalize-statements.rul txl/overrides.grm \
    txl/parenthesize-expressions.rul txl/parenthesized-types.rul txl/property-types.rul txl/redundant-types.rul \
    txl/relational-types.rul txl/rename-keywords.rul txl/rename-variables.rul txl/return-types.rul txl/stringutils.rul \
    txl/thisobject-types.rul txl/variable-types.rul

TXLC = txlc
TXLFLAGS = -s 1000 
EXE = 

# Main
all : bin bin/js2ts${EXE} bin/js2tsmf${EXE}

# Regular single file js2ts
bin/js2ts : ${SRCS}
	txlc ${TXLFLAGS} txl/js2ts.txl
	mv js2ts.x bin/js2ts${EXE}

# Multi file js2ts
bin/js2tsmf : ${SRCS}
	txlc ${TXLFLAGS} -d NOUNEXPAND txl/js2ts.txl
	mv js2ts.x bin/js2tsmf${EXE}
	
# Directories
bin :
	mkdir bin

clean :
	/bin/rm -f bin/*
